const list = [
  'supplierUserIds',
  'supplierNo',
  'dataYear',
  'num',
  'unit',
  'dataYear',
  'partCode',
  'partName',
  'specification'
];
function getRules(list: (string | string[] | any[])[]) {
  const resRules: Record<string, any> = {};
  list.forEach(item => {
    const [name, type] = typeof item === 'string' ? [item] : item;
    resRules[name] = [
      {
        required: true,
        message: '必填项',
        trigger: ['submit', 'blur', 'change']
      }
    ];
  });
  return resRules;
}

export const rules = getRules(list);
